<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>oauth2client.appengine.StorageByKeyName</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="oauth2client-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="oauth2client-module.html">Package&nbsp;oauth2client</a> ::
        <a href="oauth2client.appengine-module.html">Module&nbsp;appengine</a> ::
        Class&nbsp;StorageByKeyName
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="oauth2client.appengine.StorageByKeyName-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class StorageByKeyName</h1><p class="nomargin-top"><span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName">source&nbsp;code</a></span></p>
<center>
<center>  <map id="uml_class_diagram_for_oauth2cl_14" name="uml_class_diagram_for_oauth2cl_14">
<area shape="rect" id="node1_9" href="oauth2client.appengine.StorageByKeyName-class.html#__init__" title="Constructor for Storage." alt="" coords="18,185,465,204"/>
<area shape="rect" id="node1_10" href="oauth2client.appengine.StorageByKeyName-class.html#locked_get" title="Retrieve Credential from datastore." alt="" coords="18,204,465,223"/>
<area shape="rect" id="node1_11" href="oauth2client.appengine.StorageByKeyName-class.html#locked_put" title="Write a Credentials to the datastore." alt="" coords="18,223,465,241"/>
<area shape="rect" id="node1_12" href="oauth2client.appengine.StorageByKeyName-class.html#locked_delete" title="Delete Credential from datastore." alt="" coords="18,241,465,260"/>
<area shape="rect" id="node1" href="oauth2client.appengine.StorageByKeyName-class.html" title="Store and retrieve a credential to and from the App Engine datastore." alt="" coords="5,155,476,267"/>
<area shape="rect" id="node2_13" href="oauth2client.client.Storage-class.html#acquire_lock" title="Acquires any lock necessary to access this Storage." alt="" coords="179,36,305,55"/>
<area shape="rect" id="node2_14" href="oauth2client.client.Storage-class.html#release_lock" title="Release the Storage lock." alt="" coords="179,55,305,73"/>
<area shape="rect" id="node2_15" href="oauth2client.client.Storage-class.html#get" title="Retrieve credential." alt="" coords="179,73,305,92"/>
<area shape="rect" id="node2_16" href="oauth2client.client.Storage-class.html#put" title="Write a credential." alt="" coords="179,92,305,111"/>
<area shape="rect" id="node2_17" href="oauth2client.client.Storage-class.html#delete" title="Delete credential." alt="" coords="179,111,305,129"/>
<area shape="rect" id="node2" href="oauth2client.client.Storage-class.html" title="Base class for all Storage objects." alt="" coords="167,5,317,136"/>
</map>
  <img src="uml_class_diagram_for_oauth2cl_14.gif" alt='' usemap="#uml_class_diagram_for_oauth2cl_14" ismap="ismap" class="graph-without-title" />
</center>
</center>
<hr />
<pre class="literalblock">
Store and retrieve a credential to and from the App Engine datastore.

This Storage helper presumes the Credentials have been stored as a
CredentialsProperty or CredentialsNDBProperty on a datastore model class, and
that entities are stored by key_name.

</pre>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.appengine.StorageByKeyName-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">model</span>,
        <span class="summary-sig-arg">key_name</span>,
        <span class="summary-sig-arg">property_name</span>,
        <span class="summary-sig-arg">cache</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">user</span>=<span class="summary-sig-default">None</span>)</span><br />
      Constructor for Storage.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.appengine.StorageByKeyName-class.html#_is_ndb" class="summary-sig-name" onclick="show_private();">_is_ndb</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Determine whether the model of the instance is an NDB model.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName._is_ndb">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.appengine.StorageByKeyName-class.html#_get_entity" class="summary-sig-name" onclick="show_private();">_get_entity</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Retrieve entity from datastore.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName._get_entity">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.appengine.StorageByKeyName-class.html#_delete_entity" class="summary-sig-name" onclick="show_private();">_delete_entity</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Delete entity from datastore.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName._delete_entity">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.appengine.StorageByKeyName-class.html#locked_get" class="summary-sig-name">locked_get</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Retrieve Credential from datastore.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName.locked_get">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.appengine.StorageByKeyName-class.html#locked_put" class="summary-sig-name">locked_put</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">credentials</span>)</span><br />
      Write a Credentials to the datastore.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName.locked_put">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.appengine.StorageByKeyName-class.html#locked_delete" class="summary-sig-name">locked_delete</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Delete Credential from datastore.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName.locked_delete">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="oauth2client.client.Storage-class.html">client.Storage</a></code></b>:
      <code><a href="oauth2client.client.Storage-class.html#acquire_lock">acquire_lock</a></code>,
      <code><a href="oauth2client.client.Storage-class.html#delete">delete</a></code>,
      <code><a href="oauth2client.client.Storage-class.html#get">get</a></code>,
      <code><a href="oauth2client.client.Storage-class.html#put">put</a></code>,
      <code><a href="oauth2client.client.Storage-class.html#release_lock">release_lock</a></code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__format__</code>,
      <code>__getattribute__</code>,
      <code>__hash__</code>,
      <code>__new__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__repr__</code>,
      <code>__setattr__</code>,
      <code>__sizeof__</code>,
      <code>__str__</code>,
      <code>__subclasshook__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Properties</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Properties"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">model</span>,
        <span class="sig-arg">key_name</span>,
        <span class="sig-arg">property_name</span>,
        <span class="sig-arg">cache</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">user</span>=<span class="sig-default">None</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Constructor for Storage.

Args:
  model: db.Model or ndb.Model, model class
  key_name: string, key name for the entity that has the credentials
  property_name: string, name of the property that is a CredentialsProperty
    or CredentialsNDBProperty.
  cache: memcache, a write-through cache to put in front of the datastore.
    If the model you are using is an NDB model, using a cache will be
    redundant since the model uses an instance cache and memcache for you.
  user: users.User object, optional. Can be used to grab user ID as a
    key_name if no key name is specified.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@util.positional(4)</code></li>
    </ul></dd>
    <dt>Overrides:
        object.__init__
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="_is_ndb"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_is_ndb</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName._is_ndb">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Determine whether the model of the instance is an NDB model.

Returns:
  Boolean indicating whether or not the model is an NDB or DB model.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_get_entity"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_get_entity</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName._get_entity">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Retrieve entity from datastore.

Uses a different model method for db or ndb models.

Returns:
  Instance of the model corresponding to the current storage object
      and stored using the key name of the storage object.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_delete_entity"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_delete_entity</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName._delete_entity">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Delete entity from datastore.

Attempts to delete using the key_name stored on the object, whether or not
the given key is in the datastore.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="locked_get"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">locked_get</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName.locked_get">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Retrieve Credential from datastore.

Returns:
  oauth2client.Credentials

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@db.non_transactional(allow_existing= True)</code></li>
    </ul></dd>
    <dt>Overrides:
        <a href="oauth2client.client.Storage-class.html#locked_get">client.Storage.locked_get</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="locked_put"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">locked_put</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">credentials</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName.locked_put">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Write a Credentials to the datastore.

Args:
  credentials: Credentials, the credentials to store.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@db.non_transactional(allow_existing= True)</code></li>
    </ul></dd>
    <dt>Overrides:
        <a href="oauth2client.client.Storage-class.html#locked_put">client.Storage.locked_put</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="locked_delete"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">locked_delete</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.appengine-pysrc.html#StorageByKeyName.locked_delete">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Delete Credential from datastore.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@db.non_transactional(allow_existing= True)</code></li>
    </ul></dd>
    <dt>Overrides:
        <a href="oauth2client.client.Storage-class.html#locked_delete">client.Storage.locked_delete</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="oauth2client-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Sep 29 15:21:52 2014
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
